<div id="sidebar">
	
	<ul id="menuleft" class="menu">
		<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar 1') ) : else : ?>
		
			<li>
				<h2>Search</h2>
				<?php include_once (TEMPLATEPATH . '/searchform.php'); ?>
			</li>
	
				<?php if (is_page()) { 
					global $dlPageId;
					$parentPageId = $dlPageId;
					if ($dlPageId != null) {
					if (function_exists('get_parent_page_of')) {
					$parentPageId = get_parent_page_of($dlPageId);
					}
					$pageNavigation = wp_list_pages('child_of='.$parentPageId.'&sort_column=menu_order&title_li=&echo=0&depth=0');
					if ($pageNavigation != null) { ?>
						<li id="related_pages">
							<h2><?php _e('Related Pages'); ?></h2>
							<ul>
								<?php echo $pageNavigation; ?>
							</ul>
						</li>
				<?php }}} ?>
				
				<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
				
				<?php if (function_exists('akpc_most_popular')) { ?>
					<?php if (!is_archive() && !is_category()) { ?>
						<li id="top_ten">
							<h2>Top 10 Pages</h2>
							<ul>
								<?php akpc_most_popular(); ?>
							</ul>
						</li>
					<?php } ?>
				<?php } ?>

				<li id="recent_entries">
					<h2><?php _e('Recent Entries'); ?></h2>
					<ul>
						<?php wp_get_archives('type=postbypost&limit=10'); ?>
					</ul>
				</li>

				<?php if (function_exists('get_recent_comments')) { ?>
					<li id="recent_comments">
						<h2><?php _e('Recent Comments'); ?></h2>
						<ul>
							<?php get_recent_comments(); ?>
						</ul>
					</li>
				<?php } ?>
		
				<?php if (function_exists('get_recent_trackbacks')) { ?>
					<li id="recent_trackbacks">
						<h2><?php _e('Recent Pings'); ?></h2>
						<ul>
							<?php get_recent_trackbacks(); ?>
						</ul>
					</li>
				<?php } ?>
	
		<?php endif; ?>	
	</ul> <!-- end #menuleft -->
	
	<ul id="menuright" class="menu">
		<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar 2') ) : else : ?>
	
			<?php /* If this is a 404 page */ if (is_404()) { ?>
			<?php /* If this is a category archive */ } elseif (is_category()) { ?>
			<li class="abc">You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</li>

			<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
			<li class="abc">You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
			for the day <?php the_time('l, F jS, Y'); ?>.</li>

			<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
			<li class="abc">You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
			for <?php the_time('F, Y'); ?>.</li>

			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
			<li class="abc">You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
			for the year <?php the_time('Y'); ?>.</li>

			<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
			<li class="abc">You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
			for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</li>

			<?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
			<li class="abc">You are currently browsing the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives.</li>

			<?php } ?>

			<li>
				<h2><?php _e('Cagegories'); ?></h2>
				<ul>
					<?php wp_list_cats('sort_column=name'); ?>
				</ul>
			</li>

			<li>
				<h2><?php _e('Archives'); ?></h2>
				<ul>
					<?php wp_get_archives('type=monthly&limit=12'); ?>
				</ul>
			</li>

			<li>
				<h2 class="feed"><?php _e('RSS'); ?></h2>
				<ul>
					<li><a href="<?php bloginfo('rdf_url'); ?>" title="RDF/RSS 1.0 feed"><acronym title="Resource Description Framework">RDF</acronym>/<acronym title="Really Simple Syndication">RSS</acronym> 1.0 feed</a></li>
					<li><a href="<?php bloginfo('rss_url'); ?>" title="RSS 0.92 feed"><acronym title="Really Simple Syndication">RSS</acronym> 0.92 feed</a></li>
					<li><a href="<?php bloginfo('rss2_url'); ?>" title="RSS 2.0 feed"><acronym title="Really Simple Syndication">RSS</acronym> 2.0 feed</a></li>
					<li><a href="<?php bloginfo('atom_url'); ?>" title="Atom feed">Atom feed</a></li>
				</ul>
			</li>

		<?php endif; ?>
	</ul> <!-- end #menuright -->
	
</div> <!-- end #sidebar -->